package be.djdb.preparts;

import java.awt.BorderLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JDialog;
import javax.swing.JEditorPane;
import javax.swing.JPanel;

/**
* @author Lieven Roegiers
* @copyright 2011
* @from JAVA_mylibs
*/
public class Aboutbox extends JDialog {
	private static final long serialVersionUID = 5547910562752202887L;
	private ActionListener close=null;
	public Aboutbox(){
		this("");
    }
	public Aboutbox(String tekst){
        try{
            setDefaultCloseOperation(DISPOSE_ON_CLOSE);
            //imageLabel.setIcon(image1);
            setTitle("About"); 
            add(new ContentPanel(tekst), BorderLayout.CENTER);
    		close = new ActionListener() {
    			public void actionPerformed(ActionEvent evt) {
    				dispose();
    			}
    		};
            add(new ActionPanel("ok",close), BorderLayout.SOUTH);
            setResizable(true);
        }catch (Exception exception){
            exception.printStackTrace();
        }
        setLocation(250,250);
        setModal(true);
        pack();
        setVisible(true);
    }
    private class ActionPanel extends JPanel{
		private static final long serialVersionUID = -2476647858822604480L;
		public ActionPanel(String confirmtext, ActionListener object) {
        		JButton button = new JButton("OK");
        		button.addActionListener(object);
    			add(button);
    		
		}
    }
    private class ContentPanel extends JPanel{
		private static final long serialVersionUID = 5393455749071332785L;
		public ContentPanel(String tekst) {
           	String  x2 = "<html><title>preparst</title><b></b><br />"+tekst;
           	x2+="</html>";
        	add(new JEditorPane("text/html", x2)); 
		}
    }
}



